package cn.itsource;

import com.netflix.loadbalancer.RandomRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @description: 订单服务的启动类
 */
@SpringBootApplication
//@EnableEurekaClient：标记该应用是 Eureka客户端
@EnableEurekaClient
public class OrderServerApplication1030 {
    @Bean
    @LoadBalanced//开启负载均衡
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    public static void main(String[] args) {
        SpringApplication.run(OrderServerApplication1030.class);
    }

    @Bean
    public RandomRule randomRule() {
        return new RandomRule();
    }
}